/* Animation and Transition Styles */

/* Smooth transitions for interactive elements */
.btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* Loading animations */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pulse animation for important elements */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Slide in animation */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

/* Scale animation */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    animation: scaleIn 0.2s ease-out;
}

/* Progress bar animations */
.progress-fill {
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.mini-progress-fill {
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Notification animations */
.notification {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification.show {
    animation: slideInRight 0.3s ease-out;
}

/* Modal animations */
.modal-content {
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Form input animations */
.form-input,
.form-select,
.form-textarea {
    transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    transform: translateY(-1px);
}

/* Navigation animations */
.nav__link {
    position: relative;
    transition: all 0.2s ease;
}

.nav__link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: #2563eb;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
}

.nav__link:hover::after {
    width: 80%;
}

.nav__link.active::after {
    width: 100%;
}

/* Chart animations */
.chart-bar {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: growUp 0.6s ease-out;
}

@keyframes growUp {
    from {
        height: 0;
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Activity item animations */
.activity-item {
    transition: all 0.2s ease;
    animation: fadeIn 0.3s ease-out;
}

.activity-item:hover {
    background-color: #f8fafc;
    transform: translateX(4px);
}

/* Sleep history item animations */
.sleep-history-item {
    transition: all 0.2s ease;
    animation: fadeIn 0.3s ease-out;
}

.sleep-history-item:hover {
    background-color: #f8fafc;
    transform: translateX(4px);
}

/* Quick action button animations */
.quick-actions .btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-actions .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Success/error animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -10px, 0);
    }
    70% {
        transform: translate3d(0, -5px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

.bounce {
    animation: bounce 1s ease-in-out;
}

/* Responsive animations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support for animations */
@media (prefers-color-scheme: dark) {
    .card:hover {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    }

    .nav__link:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
}